<?php
/**
 * @uses       Custom_Validate_CurrentPassword
 * @license    Ritesh Jha (mailrkj@gmail.com)
 */

class Custom_Validate_CurrentPassword extends Zend_Validate_Abstract
{
	const ERR_INVALID_CURRENT_PASSWORD = 'ERR_INVALID_CURRENT_PASSWORD';

	public function isValid($value)
	{
		$value = Custom_General::encrypt($value);
		
		$sess_pass = Zend_Auth::getInstance()->getIdentity()->password;

		if($sess_pass == $value) return true;

		$this->_error(self::ERR_INVALID_CURRENT_PASSWORD);

		return false;
	}
}

